﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.Drawing;

namespace InsuranceCompany.Core.Domain.Client
{
    public class NaturalClient : Client
    {
        private DateTime birthday;
        private DateTime driverLicensDate;
        public DateTime Birthday 
        { 
            get
            {
                return birthday;
            }
            set
            {
                this.resetErrorMessage();
                if (value.CompareTo(DateTime.Today) == 1)
                {
                    this.setErrorMessage("Can't enter future date!");
                    return;
                }
                birthday = value;
            }
        }
        public DateTime DriverLicensDate 
        {
            get
            {
                return driverLicensDate;
            }
            set
            {
                this.resetErrorMessage();
                if (value.CompareTo(DateTime.Today) == 1)
                {
                    this.setErrorMessage("Can't enter future date!");
                    return;
                }
                driverLicensDate = value;
            }
        }

        public NaturalClient(string name, string surname, int gender, string patronymic = "", string phone = "", string email = "",
                       string adress = "") :base (name, surname, gender, patronymic, phone, email, adress)
        {
            birthday = DateTime.Today;
            driverLicensDate = DateTime.Today;
        }
        public NaturalClient() :base()
        {
            birthday = DateTime.Today;
            driverLicensDate = DateTime.Today;
        }
        public NaturalClient(NaturalClient nc) :base(nc)
        {
            birthday = nc.Birthday;
            driverLicensDate = nc.DriverLicensDate;
        }
        public NaturalClient(Client c, DateTime birthday, DateTime driverLicensDate) 
                       :base(c.Name, c.Surname, c.Gender, c.Patronymic, c.Phone, c.Email, c.Adress)
        {
            this.birthday = birthday;
            this.driverLicensDate = driverLicensDate;
        }
        
        //public Bitmap Photo { get; set; }
        public int GetDriverExperience() 
        {
            return (DateTime.Today.Year - this.DriverLicensDate.Year) * 12 + (DateTime.Today.Month - this.DriverLicensDate.Month); 
        }
        public int GetAge() 
        { 
            return DateTime.Today.Year - this.Birthday.Year; 
        }
    }
}
